﻿Imports Aricie.DNN.Modules.LuceneSearch.Business

Namespace Aricie.DNN.Modules.LuceneSearch.Logging
    Public Class StepLogger

        Private _PortalId As Integer
        Public ReadOnly Property PortalId As Integer
            Get
                Return _PortalId
            End Get
        End Property

        Private _LogActive As Boolean
        Public ReadOnly Property LogActive As Boolean
            Get
                Return _LogActive
            End Get
        End Property


        Public Sub New(LogActive As Boolean, portalId As Integer)
            _PortalId = portalId
            _LogActive = LogActive
        End Sub

        Public Sub LogStep(ByVal logType As LuceneLogType, ByVal message As String, Optional ByVal statPropertyName As String = "", Optional ByVal statPropertyValue As Integer = 0)
            If LogActive Then
                BusinessController.LogIndexingStep(logType, PortalId, message, False, statPropertyName, statPropertyValue)
            End If
        End Sub

        Public Sub LogLastStep(ByVal logType As LuceneLogType, ByVal message As String, Optional ByVal statPropertyName As String = "", Optional ByVal statPropertyValue As Integer = 0)
            If LogActive Then
                BusinessController.LogIndexingStep(logType, PortalId, message, True, statPropertyName, statPropertyValue)
            End If
        End Sub

    End Class

End Namespace